@extends('layouts.master')

@section('title')
@stop

@section('content')
<!-- display the specified match -->
<div class="panel panel-default">
	<div class="panel-heading">
    	<h3 class="panel-title">{{ $match->date.' - '.$match->field->name.' - '.$match->type->name }}</h3>
    </div>
    <div class="panel-body">
		<p><b>Administrador:</b> {{ $match->admin->name.' '.$match->admin->lastname }}</p>
		<!-- display the match teams -->
		@foreach($match->teams as $key => $value)
		<p><b>{{ $value->name }}:</b></p>
		<table class="table table-striped table-bordered">
			<thead>
				<tr>
					<td>ID</td>
					<td>Nombre</td>
					<td>Apellido</td>
					<td>Edad</td>
					<td>Email</td>
					<td>Sexo</td>
					<td>Hincha de</td>
					<td>Ubicación</td>
				</tr>
			</thead>
			<tbody>
			<!-- display the team users -->
			@foreach($value->users as $keyUsr => $valueUsr)
				<tr>
					<td>{{ $valueUsr->id }}</td>
					<td>{{ $valueUsr->name }}</td>
					<td>{{ $valueUsr->lastname }}</td>
					<td>{{ $valueUsr->age }}</td>
					<td>{{ $valueUsr->email }}</td>
					<td>{{ $valueUsr->sex }}</td>
					<td>{{ $valueUsr->fanOf }}</td>
					<td>{{ $valueUsr->location }}</td>
				</tr>
			@endforeach
			</tbody>
		</table>
		@endforeach
		<!-- display the match substitutes if there is any -->
		@if (count($match->substitutes) > 0)
    	<p><b>Suplentes:</b></p>
		<table class="table table-striped table-bordered">
			<thead>
				<tr>
					<td>ID</td>
					<td>Nombre</td>
					<td>Apellido</td>
					<td>Edad</td>
					<td>Email</td>
					<td>Sexo</td>
					<td>Hincha de</td>
					<td>Ubicación</td>
				</tr>
			</thead>
			<tbody>
			@foreach($match->substitutes as $key => $value)
				<tr>
					<td>{{ $value->id }}</td>
					<td>{{ $value->name }}</td>
					<td>{{ $value->lastname }}</td>
					<td>{{ $value->age }}</td>
					<td>{{ $value->email }}</td>
					<td>{{ $value->sex }}</td>
					<td>{{ $value->fanOf }}</td>
					<td>{{ $value->location }}</td>
				</tr>
			@endforeach
			</tbody>
		</table>
		@endif
		<!-- display the match guests if there is any -->
		@if (count($match->guests) > 0)
    	<p><b>Invitados:</b></p>
		<table class="table table-striped table-bordered">
			<thead>
				<tr>
					<td>ID</td>
					<td>Nombre</td>
					<td>Apellido</td>
					<td>Edad</td>
					<td>Email</td>
					<td>Sexo</td>
					<td>Hincha de</td>
					<td>Ubicación</td>
				</tr>
			</thead>
			<tbody>
			@foreach($match->guests as $key => $value)
				<tr>
					<td>{{ $value->id }}</td>
					<td>{{ $value->name }}</td>
					<td>{{ $value->lastname }}</td>
					<td>{{ $value->age }}</td>
					<td>{{ $value->email }}</td>
					<td>{{ $value->sex }}</td>
					<td>{{ $value->fanOf }}</td>
					<td>{{ $value->location }}</td>
				</tr>
			@endforeach
			</tbody>
		</table>
		@endif
	</div>
</div>
<p><a class="btn btn-default" href="{{ URL::to('matches') }}">&lt;&lt; Volver</a></p>
@stop
